<?php


namespace app\admin\validate;


use think\Validate;

class News extends Validate
{
    protected $rule = [
        'id'=>'require',
        'title'=> 'require|unique:news',
        'content'=>'require',
        'sort'=>'require',
        'summary'=>'require'
    ];
    protected $message = [
        'id'=>'传入的ID为空',
        'title' => '新闻名字必须填写',
        'title.unique' => "新闻名字不能重复",
        'content'=>'内容不能为空',
        'sort'=>'排序不能为空'
    ];

    protected $scene = [
        'news_add'=>['title','content','summary'],
        'news_update'=>['title','content','id','summary'],
        'news_id'=>['id'],
        'news_sort'=>['id','sort'],
        'news_status'=>['id','status']
    ];
}